#include <i386/segment.h>
#include <i386/gate.h>
#include <i386/tss.h>
#include <i386/pic.h>
#include <i386/interrupt.h>
#include <i386/memory.h>
#include <i386/debug.h>
#include <i386/mman.h>
#include <i386/pit.h>
#include <xbook/debug.h>
#include <xbook/kernel.h>

int init_arch()
{	
    /* the first thing is to init debug! */
	init_arch_debug();

    /* init segment */
    init_segment_descriptor();
    
    /* init tss, must after segment, tss will use new segment. */
    init_tss();

    /* init interrupt */
    init_gate_descriptor();
    /* intr expection setting */
    init_intr_expection();

    /* init program interrupt controller */
    init_pic();
    
    /* 初始化物理内存管理 */
    init_mman();
    
    /* 初始化时钟频率 */
    init_pit_clock();

    kernel_main();
	return 0;
}
